using DiLu.Expansion.File.Configs;
using Minio;

namespace DiLu.Expansion.File.Operates.Minio.Configs;

/// <summary>
///     获取Minio文件流配置
/// </summary>
public record GetMinioFileStreamConfig : GetFileStreamConfig
{
    /// <summary>
    ///     获取Minio文件流配置
    /// </summary>
    /// <param name="fileFullPath">文件完整路径</param>
    /// <param name="minioClient">Minio客户端</param>
    /// <param name="bucketName">桶名称</param>
    public GetMinioFileStreamConfig(string fileFullPath, IMinioClient minioClient, string bucketName) : base(fileFullPath)
    {
        ArgumentException.ThrowIfNullOrWhiteSpace(bucketName, nameof(bucketName));
        ArgumentNullException.ThrowIfNull(minioClient, nameof(minioClient));
        MinioClient = minioClient;
        BucketName = bucketName.Trim().ToLower();
    }

    /// <summary>
    ///     获取Minio文件流配置
    /// </summary>
    /// <param name="rootDirectory">根目录</param>
    /// <param name="fileGroupName">文件组名称</param>
    /// <param name="fileRelativePath">文件相对路径</param>
    /// <param name="minioClient">Minio客户端</param>
    /// <param name="bucketName">桶名称</param>
    public GetMinioFileStreamConfig(string rootDirectory, string fileGroupName, string fileRelativePath,
        IMinioClient minioClient, string bucketName) : base(rootDirectory, fileGroupName, fileRelativePath)
    {
        ArgumentException.ThrowIfNullOrWhiteSpace(bucketName, nameof(bucketName));
        ArgumentNullException.ThrowIfNull(minioClient, nameof(minioClient));
        MinioClient = minioClient;
        BucketName = bucketName.Trim().ToLower();
    }

    /// <summary>
    ///     Minio客户端
    /// </summary>
    public IMinioClient MinioClient { get; }

    /// <summary>
    ///     桶名称
    /// </summary>
    public string BucketName { get; }
}